package Com.javaserver.dao;

import Com.javaserver.bean.departmentinquire;
import Com.javaserver.bean.staff;
import Com.javaserver.utils.DB;

import java.util.List;

public class staffserver {

    //添加员工信息
    public static staff  staAdd(staff stad){
        int i =
                DB.executeUpdate
                        ("insert into staff (A_id,A_age,A_birth,A_political,A_telephone,A_school,A_education,A_department_id,A_persons,A_name,A_sex,A_code,A_marital,A_native,A_home,A_major,A_time,A_work,A_duty,A_remarks,A_operation)" +
                                        " values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                                stad.getA_id(),stad.getA_age(),stad.getA_birth(),stad.getA_political(),stad.getA_time(),stad.getA_school(),stad.getA_education(),stad.getA_departmen_id(),stad.getA_persons(), stad.getA_name(),stad.getA_sex(),stad.getA_code(),stad.getA_marital(),stad.getA_native(),stad.getA_home(),stad.getA_major(),stad.getA_time(),stad.getA_work(),stad.getA_duty(),stad.getA_remarks(),stad.getA_operation());
        if (i == -1){
            return null;
        }
        return stad;
    }



    //显示
    public List stalist(Integer page) {
        List list = DB.executeQuery("select * from staff limit ?, 10", (page - 1) * 10);
        return list;
    }



    //员工删除的封装
    public  boolean   stadele(staff sta){
        String sql="delete from  staff  where  A_id=?";
        int i=DB.executeUpdate(sql,sta.getA_id());
        return 1>0;
    }
    //更新员工的封装


}